In a quality of service (QoS) technology, data is scheduled according to service quality requirements of different services. During data scheduling, multiple queues are usually used to send data, and different queues have different priorities.
Currently, a new QoS technology, that is, a hierarchical quality of service (HQoS) technology, has emerged. In the technology, hierarchical scheduling is performed on transmission objects such as different users, different services, or even different traffic. Generally, a network device implements a traffic management function by using a traffic management (TM) chip. The TM chip that uses the HQoS technology includes multiple levels of schedulers. Each subsequent-level scheduler is configured to schedule a previous-level scheduler, and each first-level scheduler is configured to schedule multiple queues. For example, the TM chip includes four levels of schedulers. A fourth-level scheduler is configured to schedule multiple third-level schedulers according to a port level, a third-level scheduler is configured to schedule multiple second-level schedulers according to a user group level, a second-level scheduler is configured to schedule multiple first-level schedulers according to a user level, and a first-level scheduler is configured to schedule multiple queues according to a service level. In the prior art, queue allocation is strongly coupled with the first-level scheduler. That is, a fixed quantity of queues are allocated to each first-level scheduler, and each queue is used to send a type of data. For example, eight queues are allocated to each first-level scheduler, and each queue is used to send data of one type of service.
However, when a total quantity of data types is less than a fixed quantity, surplus queues are in an idle state, and a waste of queue resources is caused. When the total quantity of data types is greater than the fixed quantity, multiple different types of data share one queue, and classified scheduling cannot be performed on different types of data.